package com.eaoa.uc.address.bo;

import com.eaoa.base.EABaseBusinessObject;
import com.eaoa.dao.pub.PubCityDAO;
import com.eaoa.query.pub.PubCityQuery;
import com.stony.core.exception.RunException;

public class PubCityDeleteBO extends EABaseBusinessObject {
	private Long cityno;
	private PubCityDAO cityDAO = new PubCityDAO();

	public PubCityDeleteBO(Long cityno) {
		super();
		this.cityno = cityno;
	}

	@Override
	protected void performBusinessLogic() {
		PubCityQuery query = new PubCityQuery();
		query.setParentno(cityno);
		query.execute();
		if(query.getResults().size()>0)
			throw new RunException("error.pubcity.delete.exist.child");
		
		cityDAO.deleteByID(cityno);

	}
}
